<template>
  <a-card :bordered='false'>

    <!-- 查询区域 -->
    <search ref='search' :config='searchConfig' @search='search' @getHeight='getHeight' />
    <!-- table区域-begin -->
    <div class='page_table'>
      <vxe-grid
        ref='xGrid'
        :border='true'
        :resizable='true'
        :showOverflow='true'
        size='mini'
        :loading='loading'
        :height='pageHeight-seachHeight-90'
        :align='left'
        :columns='columns'
        :data='dataSource'
        :checkbox-config='checkboxConfig'
        :toolbar-config='tableToolbar'
        :rowSelection='{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}'
        v-bind='vexConfig'
        @checkbox-change='selectChangeEvent'
        @checkbox-all='selectChangeEvent'
      >
        <template #toolbar_buttons>
          <div class='table-operator'>
            <a-dropdown v-if='selectedRowKeys.length > 0'>
              <a-menu slot='overlay'>
                <a-menu-item key='1' @click='batchDel'>
                  <a-icon type='delete' />
                  删除
                </a-menu-item>
              </a-menu>
              <a-button style='margin-left: 8px'> 批量操作
                <a-icon type='down' />
              </a-button>
            </a-dropdown>
            <a-button type='primary' @click="downExportXls('visitInfo_report')">导出</a-button>
          </div>
        </template>

        <template #status='{ row }'>
          <a-switch :checked='row.status' size='small' @change='handleStatus(row,$event)' />
        </template>
        <template #action='{ row:record }'>
          <a @click='handleEdit1(record)'>编辑</a>
          <span v-if='record.fileUrl'>
            <a-divider type='vertical' />
            <a :href='record.fileUrl'>下载</a>
          </span>
        </template>
        <template #pager>
          <vxe-pager
            :layouts="['Total', 'PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump','Sizes', 'FullJump']"
            :currentPage.sync='ipagination.current'
            :page-size.sync='ipagination.pageSize'
            :total='ipagination.total'
            :pageSizes='ipagination.pageSizeOptions'
            @page-change='handlePageChange'>
          </vxe-pager>
        </template>
      </vxe-grid>
    </div>
    <!-- table区域-end -->
    <!-- 表单区域 -->
    <sfaVisitGroupClientEntity-modal ref='modalForm' @ok='modalFormOk'></sfaVisitGroupClientEntity-modal>
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import SfaVisitGroupClientEntityModal from './modules/SfaVisitGroupClientModal'
import { PageListMixin } from '@/mixins/PageListMixin'

export default {
  name: 'SfaVisitGroupClientList',
  mixins: [PageListMixin],
  components: {
    SfaVisitGroupClientEntityModal
  },
  data() {
    return {
      description: '铺货明细报表',
      //查询区域
      searchConfig: [
        {
          type: 'input',
          name: 'createName',
          placeholder: '创建人姓名'
        },
        {
          type: 'input',
          name: 'createDate',
          placeholder: '创建时间'
        },
        {
          type: 'input',
          name: 'createDateTime',
          placeholder: '创建时间时分秒'
        },
        {
          type: 'input',
          name: 'updateDate',
          placeholder: '更新时间'
        },
        {
          type: 'input',
          name: 'updateDateTime',
          placeholder: '更新时间时分秒'
        }
      ],
      // 表头
      columns: [
        { type: 'checkbox', width: 50, fixed: 'left' },
        {
          title: '创建人姓名',
          minWidth: 100,
          field: 'createName'
        },
        {
          title: '创建时间',
          minWidth: 80,
          field: 'createDate'
        },
        {
          title: '创建时间时分秒',
          minWidth: 140,
          field: 'createDateTime'
        },
        {
          title: '更新时间',
          minWidth: 80,
          field: 'updateDate'
        },
        {
          title: '更新时间时分秒',
          minWidth: 140,
          field: 'updateDateTime'
        },
        {
          title: '更新人姓名',
          minWidth: 100,
          field: 'updateName'
        },
        {
          title: '岗位编号',
          minWidth: 80,
          field: 'positionCode'
        },
        {
          title: '岗位名称',
          minWidth: 80,
          field: 'positionName'
        },
        {
          title: '组织编号',
          minWidth: 80,
          field: 'orgCode'
        },
        {
          title: '组织名称',
          minWidth: 80,
          field: 'orgName'
        },
        {
          title: '停用启用状态',
          minWidth: 120,
          field: 'status'
        },
        {
          title: '是否删除',
          minWidth: 80,
          field: 'deleteStatus'
        },
        {
          title: '备注',
          minWidth: 80,
          field: 'remarks'
        },
        {
          title: 'saasid',
          minWidth: 80,
          field: 'saasid'
        },
        {
          title: '线路组编号',
          minWidth: 100,
          field: 'groupCode'
        },
        {
          title: '线路组名称',
          minWidth: 100,
          field: 'groupName'
        },
        {
          title: '网点类型',
          minWidth: 80,
          field: 'clientType'
        },
        {
          title: '网点编号',
          minWidth: 80,
          field: 'clientCode'
        },
        {
          title: '网点名称',
          minWidth: 80,
          field: 'clientName'
        },
        {
          title: '操作',
          field: 'action',
          fixed: 'right',
          minWidth: 80,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/visit/sfaVisitGroupClientEntity/list',
        delete: '/visit/sfaVisitGroupClientEntity/delete',
        deleteBatch: '/visit/sfaVisitGroupClientEntity/deleteBatch',
        exportXlsUrl: 'visit/sfaVisitGroupClientEntity/exportXls',
        importExcelUrl: 'visit/sfaVisitGroupClientEntity/importExcel'
      }
    }
  },
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },
  methods: {}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>